<!DOCTYPE html>
<html class='no-js' ng-app ng-controller="DataCtrl" lang='en'>
  <head>
    <script src="./js/jquery.min.js" type="text/javascript"></script>
    <script src="./js/angular.min.js"></script>
    <meta charset='utf-8'>
    <meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>
    <title> Dashboard</title>
    <meta content='lab2023' name='author'>
    <meta content='' name='description'>
    <meta content='' name='keywords'>
  <!--   <link rel="stylesheet" href="./css/bootstrap.css"> -->
    <link href="./css/application-a07755f5.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="./font-awesome/css/font-awesome.min.css">

    <link href="css/brushes/shCoreEclipse.css" rel="stylesheet" type="text/css" />
    <link href="css/brushes/shThemeEclipse.css" rel="stylesheet" type="text/css" />

    <link href="./images/favicon.ico" rel="icon" type="image/ico" />
    <style type="text/css">
    .padding-none{
      padding-left: 0px;
      padding-right: 0px;
    }
    .form-group{
      margin-bottom: 0px;
    }
    </style>
  </head>
  <body class='main page'>
    <!-- Navbar -->
    <div class='navbar navbar-default' id='navbar'>
      <a class='navbar-brand' href='./dashboard.html'>
        <i class='icon-beer'></i>
        Cap Test Report
      </a>
    </div>
    <div id='wrapper'>
      <!-- Sidebar -->
      <section id='sidebar'>
        <i class='icon-align-justify icon-large' id='toggle'></i>
        <ul id='dock'>
          <li class='active launcher'>
            <i class='icon-dashboard'></i>
            <a href="dashboard.html">Dashboard</a>
          </li>
        </ul>
        <div data-toggle='tooltip' id='beaker' title='Made by lab2023'></div>
      </section>
      <!-- Tools -->
      <section id='tools'>
        <ul class='breadcrumb' id='breadcrumb'>
          <li class='title'>Dashboard</li>
          <li ><a href="./dashboard.html">Index</a></li>
          <li class='active'>TestCase</li>
          <li >CaseDetail</li>
        </ul>
      </section>
      <!-- Content -->
      <div id='content' ng-controller="testSuitCtrl">
        <div class="row">
   <!--        <div class='panel panel-default   col-md-4 padding-none'>
              <div class='panel-heading'>
                <i class='icon-info-sign icon-large'></i>
                <strong>{{testSuit.suitname}}</strong> Report
              </div>
              <div class='panel-body'>
              <form>
                <fieldset>
                  <legend>概况</legend>
                  <div class='form-group'>
                    <label class='control-label'>Start Time：</label>
                    {{testSuit.starttime}}
                  </div>
                  <div class='form-group'>
                    <label class='control-label'>End Time：</label>
                    {{testSuit.endtime}}
                  </div>
                  <div class='form-group'>
                    <label class='control-label'>Time(s)：</label>
                    {{testSuit.totaltime}}
                  </div>
                  <div class='form-group'>
                    <label class='control-label'>All：</label>
                    {{testSuit.total}}
                  </div>
                  <div class='form-group'>
                    <label class='control-label'>Pass：</label>
                    {{testSuit.success}}
                  </div> 
                  <div class='form-group'>
                    <label class='control-label'>Fail：</label>
                    {{testSuit.fail}}
                  </div>
                  <div class='form-group'>
                    <label class='control-label'>Skip：</label>
                    {{testSuit.skip}}
                  </div>                 
                </fieldset>      
              </form>               
              </div>
          </div> -->
          <div class='panel panel-default   col-md-12 padding-none'>
              <div  class='panel-heading'>
                <i class='icon-info-sign icon-large'></i>
                {{singleclass.classname}} 
                <div class="panel-tools">
                  <div class="btn-group">
                    <a class="btn" href="testcase.html?id={{suitid}}">
                      <i class="icon-step-backward"></i>
                      返回
                    </a>
                  </div>
                </div>
              </div>
              <div class='panel-body'>
                  <legend>{{testCase.casename}}</legend>
                  <table class='table' >
                    <thead>
                      <tr>
                        <th>#</th>
                        <th>Log Type</th>
                        <th>Log Message</th>
                        <th>Log Time</th>
                      </tr>
                    </thead>
                    <tbody>
                       <tr ng-repeat="log in testCase.log track by $index">
                          <td >{{$index + 1}}</td>
                          <td >{{log.type}}</td>
                          <td ng-switch on="log.type" >
                          <a id="line_{{$index + 1}}" ng-switch-when="Captrue" href="#capture_{{$index + 1}}">
                          <li class="icon-picture"></li> Success
                          </a>
                          <a id="line_{{$index + 1}}" ng-switch-when="File"  href="#file_{{$index + 1}}">
                          <li class="icon-file"></li> Success
                          </a>
                          <div ng-switch-default>{{log.message}}</div></td>
                          <td >{{log.time}}</td>
                      </tr>
                    </tbody>
                  </table>
              </div>
          </div> 
          <div ng-class="testCase.result==1?'hidden':''" class='panel panel-default   col-md-12 padding-none'>
              <div class='panel-heading'>
                <i class='icon-info-sign icon-large'></i>
                Exception
              </div>
              <div class='panel-body'>
                  <legend>{{testCase.casename}}</legend>
                  <pre>{{testCase.exception}}</pre>
              </div>
          </div> 

          <div ng-class="captrues.length==0?'hidden':''" class='panel panel-default   col-md-12 padding-none'>
              <div class='panel-heading'>
                <i class='icon-info-sign icon-large'></i>
                Captures
              </div>
              <div class='panel-body' ng-repeat="capture in captrues">
                  <div id="capture_{{capture.step}}" class="col-md-3">
                    <legend>Capture of <a href="#line_{{capture.step}}">Step {{capture.step}}</a></legend>
                    <img class="img-responsive"  src="{{capture.url}}">
                  </div>

              </div>
          </div> 

          <div ng-class="files.length==0?'hidden':''" class='panel panel-default   col-md-12 padding-none'>
              <div class='panel-heading'>
                <i class='icon-info-sign icon-large'></i>
                Files
              </div>
              <div class='panel-body' ng-repeat="file in files">
                  <div id="file_{{file.step}}" class="row">
                    <legend>File Content of <a href="#line_{{file.step}}">Step {{file.step}}</a></legend>
                    <div class="{{file.type==0?'col-md-12':'col-md-6'}}">
                      <pre  class=" brush: {{file.file1.format=='json'?'js':'html'}}">{{file.file1.payload}}</pre>
                    </div>
                    <div ng-ig="file.type==1" class="col-md-6">
                      <pre  class=" brush: {{file.file2.format=='json'?'js':'html'}}">{{file.file2.payload}}</pre>
                    </div>
                  </div>

              </div>
          </div>             
        </div>
      </div>
    </div>

   
    <script src="./js/jquery-ui.min.js" type="text/javascript"></script>
    <script src="./js/modernizr.min.js" type="text/javascript"></script>
    <script src="./js/md5.min.js" type="text/javascript"></script>
    
    <script src="./js/application-985b892b.js" type="text/javascript"></script>
    <script src="./js/data.js" type="text/javascript"></script>
    <script src="./js/init.js" type="text/javascript"></script>


    <script type="text/javascript" src="js/brushes/shAutoloader.js"></script>
    <script type="text/javascript" src="js/brushes/shCore.js"></script>
    <script type="text/javascript" src="js/brushes/shBrushJScript.js"></script>
    <script type="text/javascript" src="js/brushes/shBrushXml.js"></script>
    <script type="text/javascript" src="js/brushes/shBrushXml.js"></script>
    <script type="text/javascript" src="js/brushes/shBrushPhp.js"></script>
    <script type="text/javascript" src="js/vkbeautify.js"></script>

     <script type="text/javascript">
        function testSuitCtrl ($scope) {
          $scope.suitid=getUrlParam('suitid');
          $scope.testclassid=getUrlParam('testclassid');
          $scope.testcaseid=getUrlParam('testcaseid');
          var suits=$scope.testSuits.suits;
          for (var i = 0; i < suits.length; i++) {
            if(suits[i].id==$scope.suitid)
            {
              $scope.testSuit=suits[i];
              var testclases=suits[i]['testclass'];
              for (var j =0;j<testclases.length;j++)
              {
                if(testclases[j].id==$scope.testclassid)
                {
                  $scope.singleclass=testclases[j];
                  var cases=testclases[j]['cases'];
                  for(var k=0;k<cases.length;k++)
                  {
                    if(cases[k].id==$scope.testcaseid)
                    {
                      $scope.testCase=cases[k];
                      var logs=$scope.testCase.log;
                      $scope.captrues=[];
                      $scope.files=[];
                      $.each(logs,function(i,item)
                        {
                          if(item.type=='Captrue')
                          {
                            $scope.captrues.push({'step':i+1,'url':item.message});
                          }else if(item.type=='File')
                          {
                            var file={'step':i+1,'type':0,'file1':null,'file2':null};
                            files=item.message.split(";");
                            var f=$scope.testSuits.filesMap[files[0]];

                            if(f.format=='json')
                            {
                              f.payload=vkbeautify.json(f.payload, 4 );
                            }else if(f.format=='xml'){
                              f.payload=vkbeautify.xml(f.payload);
                            }else{
                              f.payload=f.payload;
                            }
                            file.file1=f;
                            
                            if(files.length==2)
                            {
                              file.type=1;
                              f=$scope.testSuits.filesMap[files[1]];
                             
                              if(f.format=='json')
                              {
                                f.payload=vkbeautify.json(f.payload, 4 );
                              }else if(f.format=='xml'){
                                f.payload=vkbeautify.xml(f.payload);
                              }else{
                                f.payload=f.payload;
                              }
                              file.file2=f;
                            }
                            $scope.files.push(file);
                          }
                        });
                      return;
                    }
                  }

                }
              }
              
            }
          };
        }
        SyntaxHighlighter.all();
     </script>
  </body>
</html>
